/*
 * @author java_deng
 * @date 2025/2/5 11:48
 * @description
 */
package org.hbwl.controller;

import org.hbwl.dto.Post;
import org.hbwl.po.AnimalPo;
import org.hbwl.po.PostPo;
import org.hbwl.service.PostService;
import org.hbwl.vo.AnimalVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/post")
public class PostController extends BaseController{
    @Autowired
    private PostService postService;
    @PostMapping("/list")
    public Object list(@RequestBody PostPo post){
        return success(postService.list(post));
    }

    @PostMapping("/managerList")
    public Object managerList(@RequestBody PostPo post){
        return success(postService.managerList(post));
    }

    @PostMapping("/audit")
    public Object audit(@RequestBody Post post){
        postService.audit(post);
        return success("审核成功");
    }

    @PostMapping("/addOrUpdate")
    public Object add(@RequestBody Post post){
        if(post.getId()!=null){
            postService.update(post);
        }else {
            postService.add(post);
        }
        return success("操作成功");
    }

    @GetMapping("/get")
    public Object get(Long id){
        return success(postService.get(id));
    }

    @GetMapping("/delete")
    public Object delete(Long id){
        postService.delete(id);
        return success("操作成功");
    }
}
